#ifndef BORDER_H_
#define BORDER_H_

#include "Vector2D.h"
#include "TextureManager.h"
#include "Object.h"
#include "LineSegment.h"
#include "Vector2DList.h"

class Border
{
	protected:
	Vector2D * borderLine;
	Vector2D * topLine;
	Vector2D * bottomLine;
	Vector2D * skirtLine;
	
	Vector2DList skirtTriangles;
	
	LineSegment * borderSegments;
	int numVertices;
	int numSegments;
	TextureManager * textureManager;
	void CalculateLines();
	float * maxStaticFrictionalForce;
	bool CheckIntersection(Vector2D leftPoint, Vector2D rightPoint);
	void SnipSkirt(Vector2DList * remainingPoints);
	void CalculateSkirt();
		
	public:
	Border();
	Border(Vector2D * borderLine, int numVertices, TextureManager * textureManager);
	virtual ~Border();
	
	bool Collide(Object * object);
	bool VertexCollide(Object * object, int vertexIndex, float * finalDistance, Vector2D * finalForce, Vector2D * finalOrigin);
	void Draw();
};
#endif /*BORDER_H_*/

